﻿using Shop.RemoteModel.LogisticsTemplate;
using Shop.RemoteModel.LogisticsTemplate.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class LogisticsTemplateService : ILogisticsTemplateService
    {
        public LTemplateDatum Get (long id)
        {
            return new GetLogisticsTemplate
            {
                Id = id
            }.Send();
        }
        public PagingResult<LTemplateDatum> Query (PagingParam<LTQueryParam> param)
        {
            return new QueryLogisticsTemplate
            {
                Index = param.Index,
                Size = param.Size,
                SortName = param.SortName,
                IsDesc = param.IsDesc,
                NextId = param.NextId,
                QueryParam = param.Query
            }.Send();
        }
        public long Add (LogisticsTemplateDatum datum)
        {
            return new AddLogisticsTemplate
            {
                Datum = datum
            }.Send();
        }
        public bool Set (long id, LogisticsTemplateDatum datum)
        {
            return new SetLogisticsTemplate
            {
                Id = id,
                Datum = datum
            }.Send();
        }
        public void Delete (long id)
        {
            new DeleteLogisticsTemplate
            {
                Id = id
            }.Send();
        }
        public bool SetIsEnable (long id, bool isEnable)
        {
            return new SetLTemplateIsEnable
            {
                Id = id,
                IsEnable = isEnable
            }.Send();
        }
        public long SetIsDefault (long id)
        {
            return new SetLTemplateDefault
            {
                Id = id
            }.Send();
        }

        public LogisticsItem[] GetItems ()
        {
            return new GetLogisticsItems().Send();
        }
    }
}
